//
//  QFCell.m
//  DouBan
//
//  Created by xubo on 14-2-14.
//  Copyright (c) 2014年 xubo. All rights reserved.
//

#import "QFCell.h"

@implementation QFCell{
    
    __weak IBOutlet UIActivityIndicatorView *activityIndicator;
    __weak IBOutlet UILabel *bookNameLabel;
    __weak IBOutlet UILabel *bookSummaryLabel;
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(void)refreshUIWithModel:(QFBookModel*)model{
    bookNameLabel.text=model.bookName;
    bookSummaryLabel.text=model.bookSummary;
    // Read 1  noRead 0
    if ([model.bookRead isEqualToString:@"1"]) {
        bookNameLabel.textColor = [UIColor redColor];
        bookSummaryLabel.textColor = [UIColor redColor];
        activityIndicator.hidden = NO;
        [activityIndicator startAnimating];
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            [activityIndicator stopAnimating];
        });
        
        
    }else{
        bookNameLabel.textColor = [UIColor blackColor];
        bookSummaryLabel.textColor = [UIColor blackColor];
        activityIndicator.hidden = NO;
        [activityIndicator stopAnimating];
    }
}
@end
